<div class="container" >
  <%= javascript_include_tag "http://webapi.amap.com/maps?v=1.2&key=test" %>
  <div class="row mbot30">
    <div class="col-lg-5 col-xs-12 col-centered">
      <%= render partial: "partial/adv", locals: { title: "店铺介绍" } %>

      <div class="row span5 col-centered broadcast" style="border: 1px solid #696;">
        <%= image_tag 'tu_04_05.png' %> <span>本店有各种家常小炒，特色小吃</span>
      </div>

      <div class="row span5 col-centered merchant_info" style="margin-top:10px;">
        <%= image_tag "tu_04_09.png" %>
        <span>订购热线：<%= @merchant_info.shop_phone_one %></span>
      </div>
      <div class="row span5 col-centered merchant_info">
        <%= image_tag "tu_04_13.png" %>
        <span>地址：<%= @merchant_info.address %></span>
      </div>
      <% if @merchant_info.shop_longitude && @merchant_info.shop_latitude %>
        <div id="iCenter">
        </div>
        <script>
          $(function() {
              var longitude = "<%= @merchant_info.shop_longitude %>";
              var latitude = "<%= @merchant_info.shop_latitude %>";

              var mapObj;
              var marker;

              //初始化地图对象，加载地图
              function mapInit(){
                mapObj = new AMap.Map("iCenter", {
                      center:new AMap.LngLat(parseFloat(longitude), parseFloat(latitude)), //地图中心点
                      level: 13,
                    });
                mapObj.plugin(["AMap.ToolBar"],function(){
                  toolBar = new AMap.ToolBar();
                  toolBar.hideDirection();

                  mapObj.addControl(toolBar);
                });
              }
              function Init_Marker(){
                  marker = new AMap.Marker({
                      position: mapObj.getCenter(),
                      });
                  marker.setMap(mapObj);  //在地图上添加点
              }
              mapInit();
              Init_Marker();
          });
        </script>
      <% end %>
    </div>
  </div>
</div>
